package com.gtp.demo.api;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TestProducer {

	@Autowired
	private RocketMQTemplate template;
	
	
	/*
	 * 有了消息转换,拦截处理  MessagePostProcessor MessageConverter(SimpleMessageConverter)
	 */
	public void test1(){
		
		template.convertAndSend("test-topic-1", "Hello, World!");
		
		//总体来说不是特别合理,完全可以自己在原生的基础上封装
//		template.setMessageConverter(messageConverter);
//		template.setCharset(charset);
//		template.setDefaultDestination(defaultDestination);
//		template.setObjectMapper(objectMapper);
//		template.setProducer(producer);
		
	}
}
